package ltd.hyangyang.vegetable.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ltd.hyangyang.vegetable.entity.Admin;
import ltd.hyangyang.vegetable.mapper.AdminMapper;
import ltd.hyangyang.vegetable.service.AdminService;
import ltd.hyangyang.vegetable.utils.Result;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements AdminService {
    @Override
    public Admin login(String account, String password) {
        //根据账号和密码查询
        QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("account",account).eq("pwd",password);

        Admin admin = baseMapper.selectOne(queryWrapper);
        return admin;
    }

    @Override
    public Admin adminInfo(String account) {
        QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("account",account);
        Admin admin = baseMapper.selectOne(queryWrapper);

        return admin;
    }
}
